﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <DataTemplate DataType="{x:Type vm:UserProfileViewModel}">
        <DataTemplate.Resources>
            <Style x:Key="Space" TargetType="{x:Type TextBlock}">
                <Setter Property="Margin" Value="3,0,3,0"/>
            </Style>
            <Style x:Key="Colon" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource Space}">
                <Setter Property="Text" Value=":"/>
            </Style>
        </DataTemplate.Resources>

        <DockPanel x:Name="panel">
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <ContentPresenter Content="{Binding Gender}"/>
                <TextBlock Style="{StaticResource Space}"/>
                <TextBlock Text="{Binding Name}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_Age}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Age}"/>
            </StackPanel>
            <Separator DockPanel.Dock="Top"/>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{Binding Path=Country, Converter={x:Static cnv:CountryConverter.Default}}"/>
                <TextBlock Style="{StaticResource Space}"/>
                <TextBlock Text="{Binding Location}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_RegisteredSince}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding RegistrationDate}"/>
            </StackPanel>
            <Separator DockPanel.Dock="Top"/>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_Knows}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=KnownLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_Learns}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=PracticingLanguages, Converter={x:Static cnv:LanguagesConverter.Default}}"/>
            </StackPanel>
            <Separator DockPanel.Dock="Top"/>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_Emails}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=ExchangesEmails, Converter={x:Static cnv:YesNoConverter.Default}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_Chats}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=ChatsOnline, Converter={x:Static cnv:YesNoConverter.Default}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
                <TextBlock Text="{c:LocalizedString s_UserStatus}"/>
                <TextBlock Style="{StaticResource Colon}"/>
                <TextBlock Text="{Binding Path=Status}"/>
            </StackPanel>
            <Separator DockPanel.Dock="Top"/>

            <FlowDocumentScrollViewer VerticalScrollBarVisibility="Auto" Document="{Binding Path=Description, Converter={x:Static vm:UserDescriptionConverter.Default}}" c:Extensions.UnbindDocumentWhenSettingsUpdated="True"/>
        </DockPanel>
        
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding IsLoading}" Value="true">
                <Setter TargetName="panel" Property="Cursor" Value="Wait"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</ResourceDictionary>